﻿using System;
using System.Collections.Generic;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace SpaceAdventureLib.Menus
{
    [Serializable]
    public class MainMenu
    {

        #region "Properties"

        private TNCGameEngine.Game game = null;
        public TNCGameEngine.Game Game
        {
            get { return this.game; }
            set { this.game = value; }
        }

        private List<SubMenu> subMenus = null;
        public List<SubMenu> SubMenus
        {
            get { return this.subMenus; }
            set { this.subMenus = value; }
        }

        private float aspectRatio = 4.0f / 3.0f;
        public float AspectRatio
        {
            get { return this.aspectRatio; }
            set { this.aspectRatio = value; }
        }

        #endregion

        #region "Constructors"

        public MainMenu(TNCGameEngine.Game game)
        {

            this.game = game;

            this.subMenus = new List<SubMenu>();
            
        }
        
        #endregion

        #region "General Methods"

        public void Initialize()
        {

            this.aspectRatio = this.game.AspectRatio;
            
            foreach (SubMenu sm in this.subMenus)
            {
                sm.Initialize();
            }
 
        }

        public void LoadContent()
        {
            foreach (SubMenu sm in this.subMenus)
            {
                sm.LoadContent();
            }
        }

        public void UnloadContent()
        {
            foreach (SubMenu sm in this.subMenus)
            {
                sm.UnloadContent();
            }
        }

        #endregion

        #region "Methods"

        public void Update(GameTime gameTime)
        {
            foreach (SubMenu m in this.subMenus)
            {
                m.Update(gameTime);
            }
        }

        public void Draw(GraphicsDevice g)
        {
            foreach (SubMenu m in this.subMenus)
            {
                m.Draw(g);
            }
        }

        #endregion


    }
}
